/*
######################################################################################################
#                                                                                                    # 
#	this page is used by doctor to change his password                                                                                                 #
#	Author: Sharvan
#	Date: 25/03/06                                                                                   # 
#	                                                                                                 # 
######################################################################################################
*/
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteManager;
public partial class Doctor_doctorChangePassword : System.Web.UI.Page
{ 
    // creating an instance of manager class
    Manager objManager;
    protected void Page_Load(object sender, EventArgs e)
    {
        //Check Doctor login
        localFunction lFunction= new localFunction();
        lFunction.checkDoctorLogin(true);
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        //Change the old password of a login doctor
        string strSql = "select password from tbl_doctors where id='" + Session["userID"] + "' and password='"+txtOPass.Text.Replace("'","''")+"' and isdelete=0";
        objManager = new Manager(true,"ConnectionString");
        System.Data.SqlClient.SqlDataReader sqlDr;
        sqlDr = objManager.ExecuteQuery(strSql);
        if (sqlDr.Read())
        {
            sqlDr.Close();
            objManager.ExecuteUpdate("update tbl_doctors set password='"+txtPass.Text.Replace("'","''")+"' where id='" + Session["userID"] + "' and password='"+txtOPass.Text.Replace("'","''")+"' and isdelete=0");
            lblAccessMessage.Text = "You have successfully changed your password";
        }
        else
        {
            sqlDr.Close();
            lblAccessMessage.Text="Old password is wrong";
        }
        objManager = null;
    }
}
